package com.yz.sharkim.entity.message;

import com.yz.sharkim.annotation.Id;
import lombok.Data;
import lombok.val;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author yangzheng
 * @version 1.0
 * @date 2019/11/4 9:29
 */
@Data
public class BaseMessage implements Serializable {
    /**
     * 消息id
     */
    protected int id;
    /**
     * 流水号
     */
    protected Integer no;
    /**
     * 创建时间
     */
    protected LocalDateTime createTime = LocalDateTime.now();

    public BaseMessage() {
        val id = this.getClass().getAnnotation(Id.class);
        if (id != null) {
            this.id = id.value();
        }
    }

    /**
     * 心跳
     */
    public static final int HEART_BEAT = 0x0;
    /**
     * 通用回复
     */
    public static final int COMMON_RESPONSE = 0x100;
    /**
     * 鉴权
     */
    public static final int AUTHENTICATION = 0x1;
    /**
     * 鉴权回复
     */
    public static final int AUTHENTICATION_RESPONSE = 0x101;
    /**
     * 获取联系人列表
     */
    public static final int GET_USER_LIST = 0x2;
    /**
     * 获取联系人列表回复
     */
    public static final int GET_USER_LIST_RESPONSE = 0X102;
    /**
     * 发送消息
     */
    public static final int SEND_MESSAGE = 0x3;
    /**
     * 接收消息
     */
    public static final int RECEIVE_MESSAGE = 0x103;
    /**
     * 添加好友
     */
    public static final int ADD_FRIEND = 0x4;
    /**
     * 好友申请
     */
    public static final int FRIEND_APPLY = 0x104;
}
